import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;

public class Term implements Serializable, Comparable<Term>
{
	private String mot; 
	private int docID;
	public Term(String Mot, int ID)
	{
		this.mot = Mot;
		this.docID = ID;
	}
	
	public String getMot()
	{
		return this.mot;
	}
	
	public int getDocID()
	{
		return this.docID;
	}
		
	public void updateMot(String chain)
	{
		this.mot = chain;
	}
	
	public void updateDocID(int id)
	{
		this.docID = id;
	}
	
	//***************************************************************//
    //******************** OVERRIDE DES OPERATEURS ******************//
    //***************************************************************//    
  	@Override
	public int compareTo(Term arg0) {
		// TODO Auto-generated method stub		
		return this.mot.compareTo(arg0.getMot());
	}           
  	@Override
  	 public boolean equals(Object obj)
  	{
  		 if (!(obj instanceof Term)) 
         {
             return false;
         }
         
  		Term other = (Term) obj;
         
         if (other.getMot().compareTo(this.getMot()) == 0 && other.getDocID() == this.getDocID()) 
         {
             return true;
         }
         return false;
  	}


}
